package com.ruoyi.meiyijia.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.meiyijia.entity.FileMeiyijiaInventory;
import com.ruoyi.meiyijia.service.FileMeiyijiaInventoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author: TheRaging
 * @date: 2023年05月18日 11:05:00
 * @description:
 */
@RestController
@RequestMapping("/meiyijia/inventory")
public class FileMeiyijiaInventoryController extends BaseController {
    
    @Autowired
    private FileMeiyijiaInventoryService fileMeiyijiaInventoryService;
    
    
    /**
     * 导入当日库存
     */
    @PreAuthorize("@ss.hasPermi('meiyijia:inventory:upload')")
    @PostMapping("/upload")
    public AjaxResult upload(MultipartFile file)
    {
      return  AjaxResult.success(fileMeiyijiaInventoryService.importExcel(file));;
    }
    
    /**
     * 查询美宜佳现有库存列表
     */
    @PreAuthorize("@ss.hasPermi('meiyijia:inventory:list')")
    @GetMapping("/list")
    public TableDataInfo list(FileMeiyijiaInventory fileMeiyijiaInventory)
    {
        startPage();
        List<FileMeiyijiaInventory> list = fileMeiyijiaInventoryService.selectFileMeiyijiaInventoryList(fileMeiyijiaInventory);
        return getDataTable(list);
    }
    
    
    
   
}